package com.yjkf.zh.admin.dao;

import com.yjkf.zh.admin.model.SysDevice;
import com.yjkf.zh.admin.model.SysUser;
import com.yjkf.zh.admin.model.SysUserDevice;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;

import java.util.Date;
import java.util.List;

public interface SysUserDeviceMapper {

    //根据用户Id带参分页查询设备列表
    List<SysUserDevice> findPageDevices(@Param(value="deviceName") String deviceName, @Param(value="id") java.lang.Long id);
    //根据用户ID
    List<SysUserDevice> findPageByDevices(@Param(value="id") java.lang.Long id);

    List<SysUserDevice> findPageAdmin(@Param(value="deviceName")String deviceName);
    List<SysUserDevice> findPageByAdmin();

    int insertUserDevice(SysUserDevice sysUserDevice);

    int updateUserDevice(SysUserDevice sysUserDevice);

    SysUserDevice findByIdAndName(@Param(value="userId") Long userId,@Param(value="nickDeviceName") String nickDeviceName);

    List<SysUserDevice> findByIdForUser(@Param(value="id") Long id,@Param(value="userId") Long userId);

    List<SysUserDevice> findByIdForUserId(@Param(value="userDeviceId") Long userDeviceId,@Param(value="userId") Long userId);
    int deleteByDevice(Long id);
    int deleteByDevices(Long userId,Long parentDeviceId);

    SysUserDevice findById(@Param(value="id") Long id);

//    SysUserDevice findByDeviceId(@Param(value="selfId") Long userId,@Param(value="deivceIdent") String ident);
    SysUserDevice findBDI(@Param(value="selfId") Long userId,@Param(value="ident") String ident);

    SysUserDevice findPointNum(@Param(value="id") Long id);

    SysUserDevice findUserDeviceCount(@Param(value="id") Long id);

    SysUserDevice getUserDeviceName(@Param(value="deviceId") Long deviceId,@Param(value="userId") Long userId);

    SysUserDevice getDeviceId(@Param(value="userDeviceId") Long userDeviceId);

    List<SysUserDevice> queryDevices(@Param(value="userId") Long userId);

    //根据parentDeviceId获取该设备组的通道数量
    SysUserDevice findForParentDeviceId(@Param(value = "parentDeviceId") Long parentDeviceId);

    //根据parentDeviceId获取该设备下的子设备列表
    List<SysUserDevice> findListForParentDeviceId(@Param(value="parentDeviceId") Long parentDeviceId);

    //时间排序查询
    List<SysUserDevice> findListForDate(SysUserDevice sysUserDevice);


    List<SysUserDevice> findfind(@Param(value="id") Long id);
    List<SysUserDevice> findByUserId(@Param(value="id") Long id);
    List<SysUserDevice> findByUserId1(@Param(value="userId") Long userId);
    List<SysUserDevice> findByUserId2(@Param(value="userId") Long userId);
    List<SysUserDevice> findByUserId3(@Param(value="userId") Long userId);
    List<SysUserDevice> findByUserId4(@Param(value="userId") Long userId);
    List<SysUserDevice> findByUserId5(@Param(value="userId") Long userId);
    List<SysUserDevice> findBUI(@Param(value="userId") Long userId);
    List<SysUserDevice> devicesForUser(@Param(value="userId") Long userId);
    List<SysUserDevice> findForUserId(Long userId);

    SysUserDevice findDeviceIdent(@Param(value="deviceIdent") String deviceIdent);

    List<SysUserDevice> findDeviceForIdentAndUserId(@Param(value="createId") Long createId,@Param(value="deviceIdent") String deviceIdent);

    //根据设备标识获取设备列表
    List<SysUserDevice> getDeviceForIdent(@Param(value="deviceIdent") String deviceIdent);

    SysUserDevice findPdfudi(@Param(value = "userDeviceId") Long userDeviceId);
}
